package org.example.Problem;

public class C {
    public boolean canReach(String s, int minJump, int maxJump) {
        int len = s.length();
        int[] nums = new int[len*2+2];
        int[] vals = new int[len*2+2];
        nums[0] = 1;nums[1] = -1;
        int sum = 0;
        for(int i=0;i<len;i++){
            sum += nums[i];
            vals[i] = sum;
            if(vals[i]>0&&s.charAt(i) == '0'){
                nums[i+minJump] += 1;
                nums[i+maxJump+1] -= 1;
            }
        }
        return s.charAt(len-1) == '0' && vals[len-1]>0;
    }
}
